public class Test2 {
    public static void main(String[] args) {
        int a = 40;
        int b = 20;
        int n = find(a,b);
        System.out.println(a + "," + b + "最大公约数是" + n);
    }

    public static int find(int a,int b){
        int c = a % b;
        while (c!=0){
            a = b;
            b = c;
            c = a % b;
        }
        return b;
    }
}


